package com.grass.cropTradingCenter.kafka;

import com.grass.cropTradingCenter.service.EmailService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
@Slf4j
public class KafkaConsume {

    @Autowired
    EmailService emailService;

    /**
     * 消费发送验证码
     *
     * @param
     */
    // todo 打开注释
//    @KafkaListener(topics = "SendEmail", groupId = "g1")
//    public void consumeEmail(String jsonString) {
//
//
//        System.out.println(Thread.currentThread().getName() + "消费了：" + jsonString);
//        Gson gson = new Gson();
//        KafkaSendEmailDto dto = gson.fromJson(jsonString, KafkaSendEmailDto.class);
//        System.out.println("idCode: " + dto.getIdCode());
//        emailService.consumeEmailCode(dto);
//    }
}
